package com.hh.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hh.mapper.TotalMapper;
import com.hh.pojo.Total;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TotalService {
    @Resource
    private TotalMapper mapper;
    //根据传感器类型查询
    public List<Total> queryTemp(){
//        QueryWrapper<Total> wrapper = new QueryWrapper<>();
//        wrapper.eq("sensorType","温湿度传感器");
        return mapper.queryTemp();
    }
    //根据时间 查询
    public List<Total> queryLight(){
//        QueryWrapper<Total> wrapper = new QueryWrapper<>();
//        wrapper.eq("sensorType","光照度传感器");
        return mapper.queryLight();
    }
    //查询整张表
    public List<Total> queryAll(){
        return mapper.queryAll();
    }
    //从硬件读取的信息存储到数据库中
    public int SaveTotal(Total total){
        return mapper.SaveTotal(total);
    }
}